package exam.test9;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Endstart
 * Date: 2020-11-03
 * Time: 10:18
 */
public class TicketMachine {
    private int total;
    private int balance;
    private int fullPrice;
    private int concessionPrice;

    public TicketMachine(int fullPrice, int concessionPrice) {
        this.fullPrice = fullPrice;
        this.concessionPrice = concessionPrice;
    }

    public int getFullPrice() {
        return fullPrice;
    }

    public int getConcessionPrice() {
        return concessionPrice;
    }

    public int getTotal() {
        return total;
    }

    public int insertMoney(int money) {
        if (money < 0) {
            throw new IllegalArgumentException();
        }
        balance += money;
        return balance;
    }

    public void printTicket(boolean student) {
        int priceTmp = fullPrice;
        if (student) {
            priceTmp = concessionPrice;
        }
        insertMoney(priceTmp);
        total += priceTmp;
    }
}
